<?php e($javascript->link('ckeditor/ckeditor')); ?>
<div class="jobs form">
<?php e($form->create('Job')); ?>
    <fieldset>
         <legend><?php __('Edit Job');?></legend>
        <!-- Job Edit Form Widfat -->
        <div class="widfats">
            <?php e($form->hidden('id')); ?>
            <?php e($form->input('title', array('class'=>'input text large'))); ?>
            <?php e($form->input('workplace', array('class'=>'input text large'))); ?>
            <ul id="tabs" class="tabs">
                <li><a href="javascript:void(0)"><?php __('Job Requirement'); ?></a></li>
                <li><a href="javascript:void(0)"><?php __('Job Introduction'); ?></a></li>
                <li class="clear"></li>
            </ul>
            <div id="panes" class="panes">
                <div>
                    <p class="faq">
                        职位要求: 包括学历, 专业背景, 性别, 政治面貌,英语等级等的要求
                        <a href="javascript:void(0)" class="use_rich_text_editor"><?php __('Use rich text editor'); ?></a>
                    </p>
                    <?php e($form->input('requirement', array('type'=>'textarea', 'label'=>false, 'class'=>'textarea'))); ?>
                </div>
                <div>
                    <p class="faq">
                        职位简介: 包括职位描述, 岗位职责, 招聘人数, 详细的工作地点等
                        <a href="javascript:void(0)" class="use_rich_text_editor"><?php __('Use rich text editor'); ?></a>
                    </p>
                    <?php e($form->input('introduction', array('type'=>'textarea', 'label'=>false, 'class'=>'textarea'))); ?>
                </div>
            </div>
        </div>
        <!-- Job Edit sidebar -->
        <div class="sidebar">
            <!-- Save Job button -->
            <div class="widget">
                <div class="toggle">&nbsp;</div>
                <h3 class="handle"><span><?php __('Edit Job');?></span></h3>
                <div class="content">
                    <?php e($form->submit(__('Update Job', true), array('class' =>'submit attention'))); ?>
                    <?php e($html->link(__('Cancel', true),
                        array('controller'=>'jobs','action'=>'index'),
                        array('class'=>'button'))); ?>
                </div>
            </div>
            <!-- Job Category Info -->
            <div class="widget">
                <div class="toggle">&nbsp;</div>
                <h3 class="handle"><span><?php __('Extra Information'); ?></span></h3>
                <div class="content">
                    <?php e($form->input('company_id', array('class'=>'select'))); ?><br class="clear"/>
                    <?php e($form->input('expire_date', array('label'=>__('Expire on this day', true), 'div'=>true, 'class'=>'select'))); ?><br class="clear"/>
                    <?php e($form->input('expired', array('label'=>__('Mark as expired', true), 'class'=>'checkbox'))); ?>
                </div>
            </div>
        </div>
    </fieldset>
<?php e($form->end());?>
</div>
<script type='text/javascript'>
jQuery(function(){
    /* Tabs */
    $('ul.tabs').tabs('div.panes > div');
    $('label[for=JobExpired]').addClass('checkbox');
    /* Validate Job Add form */
    $('#JobEditForm').submit(function(){
        if(!$(this).valid()){ return false; }
    }).validate({
        rules: {
            'data[Job][title]': 'required',
            'data[Job][workplace]': 'required',
            'data[Job][company_id]': 'required'
        },
        messages: {
            'data[Job][title]': '请不要将职位名称填为空值',
            'data[Job][workplace]': '工作地点, 必须填写, 方便学生了解更多信息',
            'data[Job][company_id]': '职位必须依赖公司而存在, 请选择1个公司'
        }
    });
    /* toggle for rich text editors */
    $('a.use_rich_text_editor').click($.sme.cbk.initBasicEditor).click();
    $.sme.cbk.datepicker();
});
</script>